
//验证支付密码是否合法
function varfiyZhifuP(zhifuPas){
	
    if(!/^\d{6}$/.exec(zhifuPas)){
    	
    	document.getElementById("form-t5").innerHTML="输入有误，请输入6为数字";
    
    	return false;
    	
    }else{
    	
    	document.getElementById("form-t5").innerHTML="";
    	return true;
    	
    }

}

//比较商品个数
function bijiao(classname,num){
	
	if(num<=1){
		document.getElementsByClassName(classname)[0].value = 1;
	}else{
		document.getElementsByClassName(classname)[0].value = Math.round(num);
	}
}

//验证号码是否已注册
function varifyLogin(phone){
	
	var xmlRequest = createXHQ();
	
	xmlRequest.open("GET","url?phone="+phone);
	
	xmlRequest.send();
	
	xmlRequest.onreadystatechange=function(){
	
		if(xmlRequest.readyState===4){
			if(xmlRequest.status===200){
				var ret = xmlRequest.responseText;
				var resultJ = JSON.parse(ret);
				
				if(reulst.reu){
					return true;
				}else{
					return false;
				}
				
				
			}else{
				alert("错误代码："+xmlRequest.status);
				return;
			}
		}
	
	}
	
}

//手机号码格式验证
function varify(phone){
	
	if(phone!=null&&phone!=""){
		
        if(!(/^1[34578]\d{9}$/.test(phone))){ 

            document.getElementById("form-t1").innerHTML="手机输入有误，请重新输入";

            return false; 

        }else{
        
        	document.getElementById("form-t1").innerHTML="";
        
        	return true;
        }
        
    }else{
    	
    	document.getElementById("form-t1").innerHTML="请输入手机号:";

        return false; 
    	
    }
}

//验证用户名是否已注册
function userLogin(userID){
	
	var xmlRequest = createXHQ();
	
	xmlRequest.open("GET","url?userID="+userID);
	
	xmlRequest.send();
	
	xmlRequest.onreadystatechange=function(){
	
		if(xmlRequest.readyState===4){
			if(xmlRequest.status===200){
				var ret = xmlRequest.responseText;
				var resultJ = JSON.parse(ret);
				
				if(!reulst.reu){
					document.getElementById("form-t2").innerHTML="该用户名已被注册：";
					return false;
				}else{
					return true;								
				}
				
				
			}else{
				alert("错误代码："+xmlRequest.status);
				return;
			}
		}
	
	}
	
}

//验证用户名是否合法
function varfiyUser(userID){
	
	if(userID!=null&&userID!=""){
		
        if(!(/^[0-9A-Za-z_]{6,9}$/.test(userID))){ 

            document.getElementById("form-t2").innerHTML="英文开头加数字，6到9位";

            return false; 

        }else{
        
        	document.getElementById("form-t2").innerHTML="";
        
        	return true;
        }
        
    }else{
    	
    	document.getElementById("form-t2").innerHTML="请输入用户名:";

        return false; 
    	
    }
}

//验证密码是否合法
function varfiyPas(password){
	
	if(password!=null&&password!=""){
		
        if((/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){8,12}$/.exec(password))){
        
        	document.getElementById("form-t3").innerHTML="强";
        
        	return true;
        }else{
        	
        	document.getElementById("form-t3").innerHTML="以英文开头 ,9到13位,下划线 .";
        
        	return false;
        }
        
    }else{
    	
    	document.getElementById("form-t3").innerHTML="请输入密码:";

        return false; 
    	
    }
}

//检验两次输入是否一样
function fitPas(password,pas1){
	
	if(password==pas1){
		
		document.getElementById("form-t4").innerHTML="一致";
		return true;
	}else{
		document.getElementById("form-t4").innerHTML="不一致";
		return false;
	}
	
}
	